package Text1;

import java.util.*;

public class Main {
    static int[] months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    public static void main(String[] args) {
        int y = 2023, m = 1, d = 1, res = 0;
        for (int i = 0; i < 365; i++) {
            String s = String.format("%04d%02d%02d", y, m, d);
             if(check(s)){
                 res++;
                 System.out.println(s);
             }
             if(++d>months[m]){
                 d=1;
                 m++;
             }
        }
        System.out.println(res);
    }

    private static boolean check(String s) {
        for (int i = 0; i+2 <s.length() ; i++) {
            if(s.charAt(i)+1==s.charAt(i+1)&&s.charAt(i)+2==s.charAt(i+2)){
                return true;
            }
        }
        return false;
    }
}
